<?php
session_start();
 $str='';
 for($i=0;$i<4;$i++)
 {
 $str.=dechex(rand(1,15));
 }
 $_SESSION['img']=$str;
 $img=imagecreatetruecolor(100,30);
 $bg=imagecolorallocate($img,0,0,0);
 $uc=imagecolorallocate($img,0,255,0);
 imagefill($img,0,0,$bg);
 imagestring($img,rand(1,6),rand(5,65),rand(5,15),$str,$uc);
 imagepng($img);
 imagedestroy($img);
 header('Content-type: image/png');
 ?> 
